//
//  ICENavigator.m
//  ICEubLib
//
//  Created by wujianrong on 16/4/12.
//  Copyright © 2016年 wanda. All rights reserved.
//

#import "ICENavigator.h"
#import "NSURL+iceNavigator.h"
#import "NSArray+IceNavigator.h"
#import "NSDictionary+iceNavigator.h"

#import "ICENavigatorAction.h"
#import "ICENavigatorQueue.h"


@implementation ICENavigator


+(void)openURLString:(id)urlString fromViewController:(UIViewController *)controller initAfterAlloc:(iceNavigatorInitAfterViewControllerAlloc)block
{
    [[ICENavigatorQueue defaultManager] addASchemeWithUrl:urlString fromViewController:controller initAfterAlloc:block];
}

+(void)openURLString:(id)urlString fromViewController:(UIViewController *)controller
{
    [[ICENavigatorQueue defaultManager] addASchemeWithUrl:urlString fromViewController:controller];
}

+(void)loadWithRootNavigationController:(UINavigationController *)navigationController schemeArray:(NSArray *)schemeArray privateUrlMappingDictionary:(NSDictionary *)privateUrlMappingDictionary publicUrlMappingDictionary:(NSDictionary *)publicUrlMappingDictionary
{
   // WDAssert([navigationController isKindOfClass:[ICENavigationController class]], @"不是ICENavigationController");
    [ICENavigatorAction loadWithRootNavigationController:navigationController schemeArray:schemeArray urlMappingDictionary:privateUrlMappingDictionary outsideUrlMappingDictionary:publicUrlMappingDictionary];
}

+(void)setTopLevelViewControllers:(NSArray *)topLevelVCs
{
    [ICENavigatorAction setTopLevelViewControllers:topLevelVCs];
}

+(void)setTopLevelViewControllers:(NSArray *)topLevelVCs exceptionViewControllers:(NSArray *)exceptionVCs
{
    [ICENavigatorAction setTopLevelViewControllers:topLevelVCs exceptionViewControllers:exceptionVCs];
}

+(void)notifyToUrlSchemeQueue
{
    [[ICENavigatorQueue defaultManager]notifyQueue];
}

+(void)addScheme:(NSString *)scheme
{
    [ICENavigatorAction addScheme:scheme];
}

+(void)addUrlMap:(NSDictionary *)urlMappingDictionary
{
    [ICENavigatorAction addUrlMap:urlMappingDictionary];
}

+(void)queuePopAllUrlscheme
{
    [[ICENavigatorQueue defaultManager]queuePopAllUrlscheme];
}

+(BOOL)canOpenOutSideWithUrlScheme:(NSString *)url
{
    return [ICENavigatorAction canOpenOutSideWithUrlScheme:url];
}

+(BOOL)canOpenUrlScheme:(NSString *)url
{
    return [ICENavigatorAction canOpenUrlScheme:url];
}

@end
